package com.hk.employeemanagementsystem.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @author by 何坤
 * @Classname MySwagger2Config
 * @Description TODO
 * @Date 2019/12/4 17:10
 */
@Configuration
public class MySwagger2Config {

    @Bean
    public Docket createRestApi(){
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.hk.employeemanagementsystem.web.controller"))
                .paths(PathSelectors.ant("/**"))
                .build()
                .groupName("group01")
                .enable(true);
    }

    private ApiInfo apiInfo(){
        Contact contact = new Contact("heixiaohuai", "https://gitee.com/heixiaohuai", "1305558920@qq.com");
        return new ApiInfoBuilder()
                .version("1.0.0")
                .description("职员管理系统后台接口文档")
                .termsOfServiceUrl("https://gitee.com/heixiaohuai/employee-management-system")
                .contact(contact)
                .title("怪人黑")
                .build();

    }


}